#import "INewsBaseSavePanel.h"
#import <appkit/Application.h>
#import <appkit/Button.h>
#import <appkit/NXBrowser.h>
#import <appkit/Form.h>
#import <strings.h>
#import "errdebug.h"

@implementation INewsBaseSavePanel

- ok:sender
{
    [super ok:sender];
    [NXApp stopModal:1];
    return(self);
}

- textDidGetKeys:textObject isEmpty:(BOOL)flag
{
    id returnValue;

    returnValue = [super textDidGetKeys:textObject isEmpty:flag];
    [okButton setEnabled:YES];
    return(returnValue);
}

- (const char *)getPath
{
    static char thePath[1024];
    const char *fileName;

    [browser getPath:thePath toColumn:[browser lastColumn]];
    DBG(1, fprintf(stderr, "#%s#", thePath);)
    fileName = [form stringValueAt:0];
    DBG(1, fprintf(stderr, "#%s#", fileName);)
    for (; *fileName == ' '; ++fileName);
    if (*fileName != '\0') {
        strcat(thePath, "/");
        strcat(thePath, [form stringValueAt:0]);
    }
    DBG(1, fprintf(stderr, "#%s#", thePath);)
    return(thePath);
}

- findHome:sender
{
    [self setDirectory:getenv("HOME")];
    return(self);
}

@end
